<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: sunhao
  Date: 2022/3/15
  Time: 21:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
    window.onload=function a(){
        $("#form").hide();
    }

        $(document).ready(function(){
        $("#toggle").click(function(){
            $("#form").toggle();
        });
    });

</script>
<body>
<h1>${requestScope.shop_name}</h1><br>
<span>${requestScope.user_name}</span><br>
<a href="${pageContext.request.contextPath}/loginout">退出</a>
<span>账户：${requestScope.account}元</span>

<button id="toggle">添加菜单</button>
<div id="form">
<form action="${pageContext.request.contextPath}/addMenu" method="get">
    <input id="shop_name" name="shop_name" value="${requestScope.shop_name}" hidden>
    <input id="user_name" name="user_name" value="${requestScope.user_name}" hidden>
    商品名：<input type="text" name="name" id="name" required><br>
    价格：<input type="text" name="price" id="price" required><br>
    <select id="type" name="type">
        <option value="早餐">早餐</option>
        <option value="中餐">中餐</option>
        <option value="午餐">午餐</option>
        <option value="甜食">甜食</option>
        <option value="米">米</option>
        <option value="面">面</option>
    </select>
    <button  type="submit">提交</button>
</form>
    <br>

</div>
<div>
    <table border="1" style=" border-spacing:0" >
        <c:forEach var="list" items="${requestScope.menu}">
            <tr>
                <td hidden>${list.id}</td>
                <td >${list.shop_name}</td>
                <td>${list.name}</td>
                <td>${list.price}</td>
                <td>${list.type}</td>
                <td><a href="${pageContext.request.contextPath}/removedServlet?id=${list.id}&&shop_name=${requestScope.shop_name}&&user_name=${requestScope.user_name}">下架</a></td>
            </tr>
        </c:forEach>
    </table>
</div>
</body>
</html>
